local duanliang = fk.CreateSkill{
    name = "cpt11__duanliang",
}

Fk:loadTranslationTable{
    ["cpt11__duanliang"] = "断粮",
    [":cpt11__duanliang"] = "每回合结束时，若你于本回合内对对手使用过牌，你可以将一张黑色非锦囊牌当【兵粮寸断】使用。",

    ["$cpt11__duanliang1"] = "截其源，断其粮，贼可擒也。",
    ["$cpt11__duanliang2"] = "人是铁，饭是钢。",
}


duanliang:addEffect(fk.TurnEnd,{
    anim_type = "special",
    can_trigger = function (self, event, target, player, data)
      return player:hasSkill(duanliang.name) and not player:isNude() and
      #player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function (e)
        local use = e.data
        return use.from == player and table.contains(use.tos, player.next)
        end, Player.HistoryTurn) == 0 and player:canUse(Fk:cloneCard("supply_shortage"))
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local cards = room:askToDiscard(player,{
            min_num = 1,
            max_num = 1,
            pattern = ".|.|spade, club|hand,equip|.|^trick|.",
            skill_name = duanliang.name,
            skip = true,
            cancelable = true,
        })
        if #cards > 0 then
            event:setCostData(self,{cards = cards})
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local cards = event:getCostData(self).cards
        room:useVirtualCard("supply_shortage", cards, player, player.next, duanliang.name)
    end,
})

return duanliang